package com.lkd.controller;

import com.lkd.dto.RegionDto;

import com.lkd.entity.Region;
import com.lkd.service.IRegionService;
import com.lkd.vo.PageBean;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vm-service/region")
public class RegionController {

    private final IRegionService regionService;

    @GetMapping("/search")
    public PageBean<Region> searchRegion(RegionDto regionDto) {
        PageBean<Region> page = regionService.search(regionDto);
        return page;
    }

    @PostMapping
    public void addRegion(Region region) {
        regionService.save(region);
    }

    @PutMapping
    public void updateRegion(Region region) {
        regionService.updateById(region);
    }

}
